import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooUserMessagesController } from '../../../controllers';
const uctoouserMessagesRouter = new Router();
const userMessagesController = new uctooUserMessagesController();

uctoouserMessagesRouter.post('/add', requireUser, userMessagesController.add);
uctoouserMessagesRouter.post('/edit', requireUser, rowLevelPermission('uctoo/user_messages'), userMessagesController.edit);
uctoouserMessagesRouter.post('/del', requireUser, rowLevelPermission('uctoo/user_messages'), userMessagesController.delete);

//For getting userMessages with permission control
uctoouserMessagesRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/user_messages'), userMessagesController.getSingle);
uctoouserMessagesRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/user_messages'), userMessagesController.getMany);
uctoouserMessagesRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/user_messages'), userMessagesController.getMany);

//#endregion AutoCreateCode
export default uctoouserMessagesRouter;
